package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import nl.coderight.jazz.dialog.MessageDialog;
import nl.coderight.jazz.dialog.MessageType;
import jtk.project4.fleet.domain.Schedules;




public class SchedulesDao extends IbatisDao{
	
	public List selectSchedules() throws SQLException {
		List selectSchedules = null;
			selectSchedules =getSqlMap().queryForList("SELECT_ALL_SCHEDULES", null);
		return selectSchedules;
	}

	public int deleteSchedules(Schedules schedules) throws SQLException{
		return (int) getSqlMap().delete("DELETE_SCHEDULES", schedules);
	}
	
	public int updateSchedules(Schedules schedules) throws SQLException{
		return (int) getSqlMap().update("UPDATE_SCHEDULES", schedules);
	}
	
	public Schedules insertSchedules(Schedules schedules) throws SQLException{
		return (Schedules) getSqlMap().insert("INSERT_SCHEDULES", schedules);
	}
	
		public List selectSchedulesType() throws SQLException {
		return getSqlMap().queryForList("SELECT_ALL_Schedules_TYPE", null);
	}
	
		
	public static void main (String args[]) throws SQLException{
		Schedules schedules;
		schedules = new Schedules();
		List<Schedules> lis ;
		schedules.setSchedId(53);
		schedules.setSchedName("Fajar");
		schedules.setDateType("");
		schedules.setDesc("Fajar");
		schedules.seteDate("GJK");
		schedules.seteUnits("Fajar");
		schedules.seteUnits2("Fajar");
		schedules.setUnitType("Fajar");
		schedules.setUnitType2("Fajar");
		schedules.setLocId(3);
		
		
		lis = new SchedulesDao().selectSchedules();
		new SchedulesDao().insertSchedules(schedules);
		
		
		//new SchedulesDao().updateSchedules(schedules);
		
		
		//new SchedulesDao().deleteSchedules(schedules);
		System.out.println(lis.size());
		}
	
}